<%--
  Created by IntelliJ IDEA.
  User: HI
  Date: 2024/5/12
  Time: 2:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="beans.Drivers" %>
<%@ page import="java.text.SimpleDateFormat" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单界面</title>
    <style>
        :root {
            --primary-color: #007BFF;
            --secondary-color: #6c757d;
            --success-color: #28a745;
            --info-color: #17a2b8;
            --warning-color: #ffc107;
            --danger-color: #dc3545;
            --light-color: #f8f9fa;
            --dark-color: #343a40;
            --border-radius: 5px;
            --box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        body {
            font-family: 'Helvetica Neue', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f8f9fa;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            line-height: 1.6;
            color: #333;
        }

        .form-container {
            background-color: #fff;
            padding: 30px;
            width: 90%;
            max-width: 800px;
            box-shadow: var(--box-shadow);
            border-radius: 10px;
            margin: 20px;
            transition: all 0.3s ease;
        }

        .form-container:hover {
            box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        }

        .form-title {
            font-size: 28px;
            text-align: center;
            margin-bottom: 30px;
            color: var(--primary-color);
            font-weight: 600;
            position: relative;
            padding-bottom: 10px;
        }

        .form-title::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 3px;
            background-color: var(--primary-color);
            border-radius: 3px;
        }

        .action-btn {
            display: inline-block;
            margin-bottom: 20px;
            padding: 8px 15px;
            background-color: var(--secondary-color);
            color: white;
            text-decoration: none;
            border-radius: var(--border-radius);
            transition: background-color 0.3s ease;
        }

        .action-btn:hover {
            background-color: #5a6268;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: var(--dark-color);
        }

        .form-group input[type="text"],
        .form-group input[type="tel"],
        .form-group input[type="email"],
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: var(--border-radius);
            font-size: 16px;
            transition: border-color 0.3s ease;
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
        }

        .readonly-field {
            background-color: #f8f9fa;
            cursor: not-allowed;
        }

        .form-actions {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 30px;
        }

        .btn {
            padding: 10px 25px;
            font-size: 16px;
            border: none;
            border-radius: var(--border-radius);
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-primary {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-primary:hover {
            background-color: #0056b3;
            transform: translateY(-2px);
        }

        .btn-secondary {
            background-color: var(--secondary-color);
            color: white;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
            transform: translateY(-2px);
        }

        @media (max-width: 768px) {
            .form-container {
                width: 95%;
                padding: 20px;
            }

            .form-title {
                font-size: 24px;
            }

            .form-actions {
                flex-direction: column;
            }

            .btn {
                width: 100%;
                margin-bottom: 10px;
            }
        }
    </style>
</head>
<%
    Drivers driver = (Drivers)request.getAttribute("driver");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
%>
<body>
<div class="form-container">
    <a href="DriversServlet?action=all" class="action-btn">返回列表</a>
    <div class="form-title">编辑司机信息</div>
    <form action="DriversServlet" method="post" enctype="multipart/form-data">
        <input type="hidden" name="action" value="edit1">
        <input type="hidden" name="driverId" value="${driver.driverId}">

        <div class="form-grid">
            <div class="form-group">
                <label for="driverId">工号</label>
                <input type="text" id="driverId" name="driverId"
                       value="${driver.driverId}" readonly class="readonly-field">
            </div>

            <div class="form-group">
                <label for="driverName">姓名</label>
                <input type="text" id="driverName" name="driverName"
                       value="${driver.driverName}" required
                       placeholder="${driver.driverName}">
            </div>

            <div class="form-group">
                <label for="phoneNumber">手机号码</label>
                <input type="tel" id="phoneNumber" name="phoneNumber"
                       value="${driver.phoneNumber}"
                       placeholder="${driver.phoneNumber}">
            </div>

            <div class="form-group">
                <label for="gender">性别</label>
                <select id="gender" name="gender">
                    <option value="男" ${driver.gender == '男' ? 'selected' : ''}>男</option>
                    <option value="女" ${driver.gender == '女' ? 'selected' : ''}>女</option>
                </select>
            </div>

            <div class="form-group">
                <label for="email">邮箱</label>
                <input type="email" id="email" name="email"
                       value="${driver.email}"
                       placeholder="${driver.email}">
            </div>

            <div class="form-group">
                <label for="driverLicenseNumber">驾驶证号</label>
                <input type="text" id="driverLicenseNumber" name="driverLicenseNumber"
                       value="${driver.driverLicenseNumber}"
                       placeholder="${driver.driverLicenseNumber}">
            </div>

            <div class="form-group">
                <label for="status">状态</label>
                <select id="status" name="status">
                    <option value="在职" ${driver.status == '在职' ? 'selected' : ''}>在职</option>
                    <option value="休假" ${driver.status == '空闲' ? 'selected' : ''}>休假</option>
                </select>
            </div>

            <div class="form-group full-width">
                <label for="remarks">备注</label>
                <textarea id="remarks" name="remarks"
                          placeholder="${driver.remarks}">${driver.remarks}</textarea>
            </div>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn btn-primary">
                <i class="fa fa-check mr-2"></i>提交修改
            </button>
            <button type="reset" class="btn btn-secondary">
                <i class="fa fa-refresh mr-2"></i>重置
            </button>
        </div>
    </form>
</div>
</body>
</html>